//
//  BaseTableViewController.swift
//  weibo02
//
//  Created by 刘涛 on 15/6/23.
//  Copyright © 2015年 tao6. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController, VisitorLoginViewDelegate {

    var VisitorView: VisitorLoginView?
    
    var userLogin = true
    
    override func loadView() {
        userLogin = false
        
        print("用户登陆\(userLogin)")
        
        userLogin ? super.loadView() : setuoVisitorView()
    }
    
    
    // 创建访客视图
    private func setuoVisitorView() {
        
        VisitorView = VisitorLoginView()
        
        VisitorView?.delegate = self
        
        view = VisitorView!
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Done, target: self, action: "VisitorRegisterButtonClick")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Done, target: self, action: "VisitorLoginButtonClick")
        
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    
    
    // 协议方法
    
    func VisitorRegisterButtonClick() {
        print("注册")
    }
    
    func VisitorLoginButtonClick() {
        print("登录")
    }

    
}
